<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<title>{lang appname}</title>
	<link href="dzz/corpus/images/mobile/css/weui.css?{VERHASH}" rel="stylesheet" media="all">
	<link href="dzz/corpus/images/mobile/css/my.css?{VERHASH}" rel="stylesheet" media="all">
	<script src="static/jquery/jquery.min.js?{VERHASH}" type="text/javascript"></script>
</head>
<body>
<div class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form">
        <div class="weui-search-bar__box">
            <i class="weui-icon-search"></i>
            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="{lang search}" required="">
            <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <i class="weui-icon-search"></i>
            <span>{lang search}</span>
        </label>
    </form>
    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">{lang cancel}</a>
</div>
<div style="padding-bottom: 50px;">
	<!-- 标星的 -->
	<div class="container-fluid window-module-star <!--{if !$stared}-->hide<!--{/if}-->">
		<span class="article_title">{lang star_sign}</span>
		<ul id="board_list_stared" class="app_ul">
			<!--{loop $stared $value}-->
			<li id="board_star_$value[cid]" data-cid="$value[cid]">
				<a class="app_ul_a" href="{MOD_URL}&op=list&cid=$value[cid]">
					<span class="app-book"></span>
					<span class="app_spanTitle">$value[name]</span>
					<span class="app_star app-add-icon"></span>
				</a>
			</li>
			<!--{/loop}-->
		</ul>
	</div>
	<!-- 结束 -->

	<!-- 我的 -->
	<div class="container-fluid window-module-my">
		<span class="article_title">{lang mine}
			<a class="app_add" aria-hidden="true" style="color:#91868B;" href="{MOD_URL}&op=menu&do=newcorpus&orgid=0"></a>
		</span>
		<ul id="board_list_0" class="app_ul">
			<!--{loop $my $value}-->
			<li data-cid="$value[cid]">
				<a class="app_ul_a" href="{MOD_URL}&op=list&cid=$value[cid]">
					<span class="app-book"></span>
					<span class="app_spanTitle">$value[name]</span>
					<span class="app_star <!--{if in_array($value[cid],$stared_cids)}-->app-add-icon<!--{/if}-->"></span>
				</a>
			</li>
			<!--{/loop}-->
		</ul>
	</div>
	<!-- 结束 -->

	<!-- 小组 -->
	<!--{loop $orglist $org}-->
	<div class="container-fluid">
		<span class="article_title">$org[name]
			<span class="glyphicon glyphicon-chevron-right" style="font-size: 12px;"></span>
			<a class="app_add" aria-hidden="true" style="color:#91868B;" href="{MOD_URL}&op=menu&do=newcorpus&orgid=$org[orgid]"></a>
		</span>
		<ul id="board_list_$org[orgid]" class="app_ul">
			<!--{loop $org[list] $value}-->
			<li data-cid="$value[cid]">
				<a class="app_ul_a" href="{MOD_URL}&op=list&cid=$value[cid]">
					<span class="app-book"></span>
					<span class="app_spanTitle">$value[name]</span>
					<span class="app_star <!--{if in_array($value[cid],$stared_cids)}-->app-add-icon<!--{/if}-->"></span>
				</a>
			</li>
			<!--{/loop}-->
		</ul>
	</div>
	<!--{/loop}-->
	<div class="container-fluid">
		<a href="{MOD_URL}&op=menu&do=addorg"><span class="article_title">{lang new_team}></span></a>
	</div>
	<!-- 结束 -->
</div>
<div class="app_footer">
	<div style="flex: 1;">
		<a href="{BASESCRIPT}?mod=corpus">{lang index}</a>
	</div>
	<div style="flex: 1;">
		<a href="{BASESCRIPT}?mod=corpus&op=archive">{lang the_archive}</a>
	</div>
	<div style="flex: 1;">
		<a href="{BASESCRIPT}?mod=corpus&op=delete">{lang the_deleted}</a>
	</div>
</div>
<script type="text/javascript">
window.onload = function(){
	jQuery(document).on('click','.app_star',function(){
		var el=jQuery(this);
		var cid=el.closest('li').data('cid');
		var view=jQuery('li[data-cid="'+cid+'"]');
		if(el.hasClass('app-add-icon')){
			view.find('.app_star').removeClass('app-add-icon');
			jQuery('#board_list_stared li[data-cid="'+cid+'"]').remove();
		}else{
			view.find('.app_star').addClass('app-add-icon');
			view.clone().appendTo('#board_list_stared');
		}
		var cids=[];
		jQuery('#board_list_stared li').each(function(){
			cids.push(jQuery(this).data('cid'));
		});
		if(cids.length){		
			jQuery('.window-module-star').removeClass('hide');
		}else{
			jQuery('.window-module-star').addClass('hide');
		}		
		jQuery.post('{MOD_URL}&op=ajax&do=setStar',{"cids":cids});
		return false;
	});	
}



// 搜索
jQuery(function(){
        var searchBar = jQuery('#searchBar'),
            searchResult = jQuery('#searchResult'),
            searchText = jQuery('#searchText'),
            searchInput = jQuery('#searchInput'),
            searchClear = jQuery('#searchClear'),
            searchCancel = jQuery('#searchCancel');

        function hideSearchResult(){
            searchResult.hide();
            searchInput.val('');
        }
        function cancelSearch(){
            hideSearchResult();
            searchBar.removeClass('weui-search-bar_focusing');
            searchText.show();
        }

        searchText.on('click', function(){
            searchBar.addClass('weui-search-bar_focusing');
            searchInput.focus();
        });
        searchInput
            .on('blur', function () {
                if(!this.value.length) cancelSearch();
            })
            .on('input', function(){
                if(this.value.length) {
                    searchResult.show();
                } else {
                    searchResult.hide();
                }
            })
        ;
        searchClear.on('click', function(){
            hideSearchResult();
            searchInput.focus();
        });
        searchCancel.on('click', function(){
            cancelSearch();
            searchInput.blur();
        });
    });

// 结束
</script>
</body>

</html>